from rest_framework.permissions import BasePermission

class IsHRUser(BasePermission):
    """
    自定义权限：只允许角色为 'hr' 的用户访问。
    """
    def has_permission(self, request, view):
        return bool(request.user and request.user.is_authenticated and request.user.role == 'hr')

class IsCandidateUser(BasePermission):
    """
    自定义权限：只允许角色为 'candidate' 的用户访问。
    """
    def has_permission(self, request, view):
        return bool(request.user and request.user.is_authenticated and request.user.role == 'candidate') 